package com.diaohw.module.system.obj.tables;

import com.diaohw.platform.framework.db.flex.obj.tables.BaseTableDef;
import com.mybatisflex.core.query.QueryColumn;

import java.io.Serial;

/**
 * 用户 表定义层。
 *
 * @author D-Hw
 * @since 2024-11-15 18:22:15
 */
public class AccountRoleDef extends BaseTableDef {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户
     */
    public static final AccountRoleDef ACCOUNT_ROLE = new AccountRoleDef();

    /**
     * 加密盐值
     */
    public final QueryColumn ACCOUNT_ID = new QueryColumn(this, "ACCOUNT_ID");

    /**
     * 邮箱
     */
    public final QueryColumn ROLE_ID = new QueryColumn(this, "ROLE_ID");


    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ROLE_ID,ACCOUNT_ID};

    public AccountRoleDef() {
        super("", "ACCOUNT_ROLE");
    }

    private AccountRoleDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public AccountRoleDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new AccountRoleDef("", "ACCOUNT_ROLE", alias));
    }

}
